package org.alino.core.shiro.token.tokens;

import org.alino.core.shiro.token.realms.BaseRealm;
import org.alino.core.shiro.token.realms.MobileRealm;
import org.apache.shiro.authc.UsernamePasswordToken;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Desc TODO
 * @Author by Brant
 * @Date 2017/1/13
 */
public class BaseToken extends UsernamePasswordToken implements Serializable {
    private static final long serialVersionUID = 4042698420049618404L;
    public static final byte TOKEN_LOGIN_BY_MOBILE = 2;
    public static Map<Byte,Class<? extends BaseRealm>> TOKEN_TYPE = new HashMap<>();
    static {
        TOKEN_TYPE.put(TOKEN_LOGIN_BY_MOBILE,MobileRealm.class);
    }

    private byte type;
    /**
     * 密码
     */
    private String pwd;
    /**
     * 验证吗
     */
    private String captcha;
    /**
     * 短信验证码
     */
    private Long smsCode;

    public BaseToken(String account,String password){
        super(account,password);
        this.pwd = password;
    }

    public BaseToken(String account,String password,boolean rememberMe){
        super(account,password,rememberMe);
        this.pwd = password;
    }

    public BaseToken(String account,String password,String captcha){
        super(account,password);
        this.pwd = password;
        this.captcha = captcha;
    }

    public BaseToken(String account,String password,String captcha,boolean rememberMe){
        super(account,password,rememberMe);
        this.pwd = password;
        this.captcha = captcha;
    }

    public BaseToken(String account,String password,Long smsCode){
        super(account,password);
        this.pwd = password;
        this.smsCode = smsCode;
    }

    public BaseToken(String account,String password,Long smsCode,boolean rememberMe){
        super(account,password,rememberMe);
        this.pwd = password;
        this.smsCode = smsCode;
    }

    public byte getType() {
        return type;
    }

    public void setType(byte type) {
        this.type = type;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public String getCaptcha() {
        return captcha;
    }

    public void setCaptcha(String captcha) {
        this.captcha = captcha;
    }

    public Long getSmsCode() {
        return smsCode;
    }

    public void setSmsCode(Long smsCode) {
        this.smsCode = smsCode;
    }
}
